package com.fafa.thread;

public class CatAndDog {
    public static void main(String[] args) {
        Cat cat = new Cat();
        cat.start();
        Dog dog = new Dog();
        dog.start();

    }
}

class Cat extends Thread {
    int count = 0;
    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            System.out.println("喵喵喵" + count++);
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }

    }
}
class Dog extends Thread {
    int count = 0;
    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            System.out.println("汗汗汗" + count++);
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
